﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Entity;
using System.Data.EntityClient;
using System.Data.EntityModel;
using System.Data.Query;
using System.Web.Security ;
using OrmAuto;
    
public partial class Adm_GestioneUtenti : System.Web.UI.Page
{

    QueryUtenti mqUtenti =new QueryUtenti(); 
    protected int mTotUtentiOnline=0;
    protected void Page_Load(object sender, EventArgs e)
    {
								inizializza();								              
    }

				private void inizializza()
				{
					 this.LabelUtentiOnLine.Text = Membership.GetNumberOfUsersOnline().ToString();					 
					 this.LabelNumUtenti.Text = mqUtenti.getUtentiCount().ToString(); 
				}


   //tutti utenti
				protected void Button1_Click(object sender, EventArgs e)
				{
						this.GridView1.DataSource =  mqUtenti.getUtenti(); 
						this.GridView1.DataBind();  
				}

    //vede abilitati o meno a seconda del command argument
				protected void Button2_Click(object sender, EventArgs e)
				{
				 string ca =((Button)sender).CommandArgument ;
     if(ca == "1")
							this.GridView1.DataSource = mqUtenti.getUtentiAbilitati(true );
					else
							this.GridView1.DataSource = mqUtenti.getUtentiAbilitati(false);
					 					
					this.GridView1.DataBind(); 
					
       
				}
				protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
				{
				  int selectedUserID =0;
						this.ChkListRuoli.DataSource = mqUtenti.getRuoliUtente(selectedUserID);   
				}

				protected void ListBoxFindUtenti_SelectedIndexChanged(Object sender, EventArgs e)
				{
						//refreshDatiUtente(null);
				}//fM

				public void ButtonShow_Click(object sender, EventArgs e)
				{
						//ControlCheckSoc();
						//refreshDatiUtente(null);

				}//fM
				
				
}//fC
